home *** CD-ROM | disk | FTP | other *** search
- /* ======================================================================
- DESC: Common Alert Functions for the Administer/Analyze Operations
-
- PLATFORMS: >= MS IE 4.0
-
- USAGE NOTES:
- ====================================================================== */
-
- var AlertRecLength = 24; // Alert Lookup record length
-
- /* Process Alert LOOKUP RECORD Event */
- function AlertLupRecPart1(AlID, AlName, AlDesc, AlThresh, AlOver, AlEveryTime, AlDur, AlSched, AlSDT, AlEDT, AlArrayIDs) {
- AlDependencyID = "";
- if ( AlSDT == "01/01/1999 11:30:00" || AlSDT == "1/1/1999 11:30:0" ) { // Service type
- if ( top.banner.CurrentPageName == "AdminAlerts" ) {
- addElementToSelect(AL_DependencySel,AlName); // populate the Dependency choice
- }
- }
- // Parse Out Dependency, Suppress Monitoriing & CounterWatch Max Alerts
- var di = AlDesc.indexOf("[]");
- if ( di >= 0 ) {
- AlDependencyID = AlDesc.substr(di+2);
- AlDesc = AlDesc.substr(0,di);
- }
-
- var i = AlertLupRecCount * AlertRecLength;
- if ( getAlertName(AlID) == "" ) { // if not received yet
- addElementToSelect(AL_AlertSel,AlName);
- AlertStoreArr[i++] = AlName; //+0
- AlertStoreArr[i++] = AlID;
- AlertStoreArr[i++] = AlDesc;
- AlertStoreArr[i++] = AlThresh;
- AlertStoreArr[i++] = AlOver; //+4
- AlertStoreArr[i++] = AlEveryTime;
- AlertStoreArr[i++] = AlDur;
- AlertStoreArr[i++] = AlSched;
- AlertStoreArr[i++] = AlSDT;
- AlertStoreArr[i++] = AlEDT; //+9
- AlertStoreArr[i++] = AlArrayIDs; //+10
- /* allocate space for Part 2 */
- AlertStoreArr[i++] = ""; //+11
- AlertStoreArr[i++] = "";
- AlertStoreArr[i++] = "";
- AlertStoreArr[i++] = ""; //+14
- AlertStoreArr[i++] = "";
- AlertStoreArr[i++] = "";
- AlertStoreArr[i++] = "";
- AlertStoreArr[i++] = "";
- AlertStoreArr[i++] = ""; //+19
- AlertStoreArr[i++] = "";
- AlertStoreArr[i++] = "";
- AlertStoreArr[i++] = ""; //+22
- AlertStoreArr[i++] = AlDependencyID; //+23
- }
- else { // already received Part 2, update Part 1
- ASix = AlertSelectIdx * AlertRecLength;
- AL_AlertSel.options[ASix].text = AlName;
- AlertStoreArr[ASix+0] = AlName;
- AlertStoreArr[ASix+2] = AlDesc;
- AlertStoreArr[ASix+3] = AlThresh;
- AlertStoreArr[ASix+4] = AlOver;
- AlertStoreArr[ASix+5] = AlEveryTime;
- AlertStoreArr[ASix+6] = AlDur;
- AlertStoreArr[ASix+7] = AlSched;
- AlertStoreArr[ASix+8] = AlSDT;
- AlertStoreArr[ASix+9] = AlEDT;
- AlertStoreArr[ASix+10] = AlArrayIDs;
- }
- ++AlertLupRecCount; // bump record received counter
- }
-
- function AlertLupRecPart2(AlID, AlRunProg, AlProgNme, AlProgramArgs, AlENotify, AlEAddr, AlESubj, AlPhNotify, AlPhNumber, AlTextToSpeak, AlPgNotify, AlPgNumber, AlTextToSend) {
- UNameObj = document.all.AL_AlertSel; // Alert Name Combo box
- if ( getAlertName(AlID) == "" ) { // if not received yet
- // allocate space for Part 1
- AlertStoreArr[i++] = "name"; //+0
- AlertStoreArr[i++] = AlID;
- AlertStoreArr[i++] = "";
- AlertStoreArr[i++] = "";
- AlertStoreArr[i++] = ""; //+4
- AlertStoreArr[i++] = "";
- AlertStoreArr[i++] = "";
- AlertStoreArr[i++] = "";
- AlertStoreArr[i++] = "";
- AlertStoreArr[i++] = ""; //+9
- AlertStoreArr[i++] = ""; //+10
- /* save Part 2 */
- AlertStoreArr[i++] = AlRunProg; //+11
- AlertStoreArr[i++] = AlProgNme;
- AlertStoreArr[i++] = AlProgramArgs;
- AlertStoreArr[i++] = AlENotify; //+14
- AlertStoreArr[i++] = AlEAddr;
- AlertStoreArr[i++] = AlESubj;
- AlertStoreArr[i++] = AlPhNotify;
- AlertStoreArr[i++] = AlPhNumber;
- AlertStoreArr[i++] = AlTextToSpeak; //+19
- AlertStoreArr[i++] = AlPgNotify;
- AlertStoreArr[i++] = AlPgNumber;
- AlertStoreArr[i++] = AlTextToSend; //+22
- AlertStoreArr[i++] = ""; //+23
- }
- else { // already received Part 2, update Part 1
- ASix = AlertSelectIdx * AlertRecLength;
- AlertStoreArr[ASix+11] = AlRunProg;
- AlertStoreArr[ASix+12] = AlProgNme;
- AlertStoreArr[ASix+13] = AlProgramArgs;
- AlertStoreArr[ASix+14] = AlENotify;
- AlertStoreArr[ASix+15] = AlEAddr;
- AlertStoreArr[ASix+16] = AlESubj;
- AlertStoreArr[ASix+17] = AlPhNotify;
- AlertStoreArr[ASix+18] = AlPhNumber;
- AlertStoreArr[ASix+19] = AlTextToSpeak;
- AlertStoreArr[ASix+20] = AlPgNotify;
- AlertStoreArr[ASix+21] = AlPgNumber;
- AlertStoreArr[ASix+22] = AlTextToSend;
- }
- }
-
- /* Process Combo Alert Name Change Event */
- function processAlertName() {
- if ( ALupMode != "" || AL_AlertSel.disabled == "disabled")
- return; // ignore if Busy
- Nobj = document.all.AL_AlertSel; // get object
- for (i=0; i < Nobj.length; ++i) {
- if ( Nobj.options[i].selected ) {
- AlertSelectIdx = i;
- document.all.AL_AlertSel.blur(); // take focus away
- populateInput(AlertRecLength*i);
- break;
- }
- }
- }
-
- /* Process DB Error in Alert Lookup Operation */
- function processAlertOpError() {
- top.Rstatus.Pstat("An error occurred during Alert LOOKUP operation",true);
- processResetButton(); // reset
- }
-
- /* Get Alert Name from Store based on Alert ID */
- function getAlertName(UID) {
- AlertName = "";
- for (i=0, j=0; i < AlertStoreArr.length; ++j, i+=AlertRecLength) {
- if ( AlertStoreArr[i+1] == UID ) {
- AlertName = AlertStoreArr[i];
- AlertSelectIdx = j;
- document.all.AL_AlertSel.options[j].selected = "selected";
- break;
- }
- }
- return AlertName;
- }
-
- /* Get Alert ID from Store based on Alert Name */
- function getAlertID(UNM) {
- UID = 0;
- for (i=0, j=0; i < AlertStoreArr.length; ++j, i+=AlertRecLength) {
- if ( AlertStoreArr[i] == UNM ) {
- AlertSelectIdx = j;
- UID = AlertStoreArr[i+1];
- break;
- }
- }
- return UID;
- }
-
- /* Process Duplicate Error in Alert Add / Replace Operation */
- function processAlertUpdateErrorDuplicate() {
- top.Rstatus.Pstat("A duplicate Alert already exists in the DataBase. Cannot complete the UPDATE request",true);
- alert("A Watch/Alert already exits with this Name. Please specify a unique Name for this Watch/Alert");
- SetButtonState(UUpdateButton,"0");
- }
-
- /* Process Alert ID Not Found Error in EDIT/UPDATE Operation */
- function processAlertUpdateErrorBadAlert() {
- top.Rstatus.Pstat("Alert not found in the DataBase. Cannot complete the UPDATE/DELETE request",true);
- processResetButton(); // reset
- }
-
- /* Get Object Name and Description from Store based on Object ID */
- function getObjectName(OID) {
- var IDAr = new Array(); // ID array
- var OCAr = new Array(); // Individual Object,Computer
- for (var i=0, j=0; i < AL_OCStoreArr.length; ++j, i+=ObjectRecLength) {
- IDAr = AL_OCStoreArr[i+2].split(";"); // get ID Array
- for ( var k=0; k<IDAr.length; k++ ) {
- OCAr = IDAr[k].split(",");
- if ( OCAr[0] == OID ) {
- CurObjIx = j; // Ibject index
- Odsc = AL_OCStoreArr[i+1]; // description
- if ( Odsc.charAt(0) == "{" ) { // if instance
- k = i; // get/preserve Object index
- while ( (k-=ObjectRecLength) >= 0 ) {
- if ( AL_OCStoreArr[k+1] == Odsc ) {
- continue; // if another instance
- }
- else {
- Odsc = AL_OCStoreArr[k+1];
- break;
- }
- } // end While
- }
- return AL_OCStoreArr[i] + "," + Odsc;
- }
- }
- }
- return null;
- }
-
- /* Process DB Error in Object Lookup Operation */
- function processObjectOpError() {
- top.Rstatus.Pstat("An error occurred during Object LOOKUP operation",true);
- processResetButton(); // reset
- }
-
- /* Process DB Error in Counter Lookup Operation */
- function processCounterOpError() {
- top.Rstatus.Pstat("An error occurred during Counter LOOKUP operation",true);
- processResetButton(); // reset
- }
-
- /* Process DB Error in Computer Lookup Operation */
- function processComputerOpError() {
- top.Rstatus.Pstat("An error occurred during Computer LOOKUP operation",true);
- processResetButton(); // reset
- }
-
-
-